package com.bkgy.modular.upAndDownLine.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.modular.upAndDownLine.entity.UpAndDownLineC621;
import com.bkgy.modular.upAndDownLine.mapper.UpAndDownLineC621Mapper;
import com.bkgy.modular.upAndDownLine.service.UpAndDownLineC621Service;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

/**
 * @author ZhuHongKai
 * @version 1.0
 * @ClassName UpAndDownLineC621ServiceImpl
 * @date 2023/1/5 10:35
 */
@Service
public class UpAndDownLineC621ServiceImpl extends ServiceImpl<UpAndDownLineC621Mapper, UpAndDownLineC621> implements UpAndDownLineC621Service {

    @Resource
    private UpAndDownLineC621Mapper upAndDownLineC621Mapper;

    @Override
    public ResultData findUpDownLineC621(JSONObject jsonObject) {
        String cold_coil_id = jsonObject.getString("cold_coil_id");
        // 检查hot_coid_id是否为null或者为空
        if (StringUtils.isEmpty(cold_coil_id)) {
            return ResultData.ResultDataFaultSelf("传入卷号不得为空",null);
        }
        LambdaQueryWrapper<UpAndDownLineC621> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UpAndDownLineC621::getCoil_id,cold_coil_id);
        UpAndDownLineC621 list = upAndDownLineC621Mapper.selectOne(queryWrapper);
        return ResultData.ResultDataFaultSelf("查询成功",list);
    }
}
